struct Solution {}

fn main() {}

impl Solution {
    pub fn count_tested_devices(battery_percentages: Vec<i32>) -> i32 {
        let mut ret = 0;
        let mut battery_cp = battery_percentages.clone();

        for idx in 0..battery_percentages.len() {
            if battery_cp[idx] == 0 {
                continue;
            }
            ret += 1;
            for idy in idx+1..battery_percentages.len() {
                if battery_cp[idy] > 0 {
                    battery_cp[idy] -= 1;
                }
            }
        }
        ret
    }
}